home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / tbasmhlp.arc / SOURCE.ARC / FINDDATA.ASM < prev    next >
Assembly Source File  |  1987-07-21  |  3KB  |  93 lines

  1. ;FILE    :FINDDATA.ASM
  2. ;USEAGE    :call finddata(FILENAME$,FILELEN&,MO%,DY%,YR%,HR%,MN%,FILEATTR%)
  3. ;              22     1e       1a  16  12  0e  0a  06
  4. ;Findata returns file data results from FINDFILE or FINDNEXT into variables
  5.  
  6. finddata segment
  7. assume    cs:finddata
  8.     push    bp        ;Standard stuff.
  9.     mov    bp,sp
  10.     push    ds
  11.  
  12.     mov    dx,ds:[0]    ;Current string segment.
  13.     push    dx
  14.     pop    ds        ;THERE! String's segment is ds.
  15.  
  16.     les    di,[bp+022h]    ;String descripter's pointer
  17.     mov    si,es:[di+2]    ;offset of string in DS seg.
  18.     mov    cx,es:[di]    ;Length of string.. should always be 12.
  19.  
  20.     mov    ah,02fh        ;Get current DTA (Should have our filename!)
  21.     int    021h        ;MSDOS. ES:BX should now be DTA.
  22.  
  23.     add    bx,21        ;skip over reserved area.
  24. ;First do filename.
  25.     mov    di,bx
  26. movenm:    mov    al,es:[di+9]    ;+9 to skip over time/date info..
  27.     cmp    al,'.'        ;are we at period yet?
  28.     jne    goahead        ;Nope
  29.     cmp    cx,4        ;are we in 9th pos yet?
  30.     jne    goahd2        ;If we are, go ahead and let dot go through
  31. goahead:cmp    al,0        ;end of file?
  32.     jne    goahd3        ;nope
  33. goahd2:    mov    al,' '        ;To early! let's just put a space in it's place.
  34.     dec    di
  35. goahd3:    mov    [si],al
  36.     inc    di
  37.     inc    si
  38.     loop    movenm
  39.     push    es        ;Current DTA segment
  40.     pop    ds        ;Set [DS] to DTA segment.
  41.  
  42. ;Now do attribute.
  43.     mov    di,bx        ;[DI] = offset.
  44.     les    si,[bp+06h]    ;Address of Attribute integer
  45.     mov    al,[di]        ;Attribute
  46.     mov    ah,0
  47.     mov    es:[si],ax    ;Store attribute
  48. ;Now do time
  49.     les    si,[bp+0ah]    ;Address of minutes integer.
  50.     mov    ax,[di]+1    ;Hours/minutes/even secs of file.
  51.     mov    cl,5        ;rotate 5 times folks
  52.     shr    ax,cl
  53.     push    ax        ;Save it, still need to do hours
  54.     and    ax,111111b    ;Mask off, only save minutes
  55.     mov    es:[si],ax    ;Store minutes!
  56.     pop    ax
  57.     inc    cl        ;rotate 6 times folks
  58.     shr    ax,cl        ;Move it over rover.
  59.     les    si,[bp+0eh]    ;Address of hours integer
  60.     mov    es:[si],ax    ;Store hours.
  61. ;Now do date.
  62.     les    si,[bp+016h]    ;Address of days.
  63.     mov    ax,[di]+3    ;Date word.
  64.     push    ax        ;save it for month/year yet.
  65.     and    ax,11111b    ;Mask of month/year
  66.     mov    es:[si],ax    ;store day
  67.     pop    ax
  68.     dec     cl        ;Rotate 5 times folks
  69.     shr    ax,cl        ;Rotate days off the world
  70.     push    ax
  71.     les    si,[bp+01ah]    ;Address of month integer.
  72.     and    ax,1111b    ;Mask off year.
  73.     mov    es:[si],ax
  74.     pop    ax
  75.     dec    cl        ;Rotate 4 times folks
  76.     shr     ax,cl        ;Year should now be low bits.
  77.     add    ax,80        ;Let's makeit 87
  78.     les    si,[bp+012h]    ;Address of year integer
  79.     mov    es:[si],ax
  80. ;Now do filesize.
  81.     les    si,[bp+01eh]    ;Address of filesize double int.
  82.     mov    ax,[di]+5    ;Low word of filesize in DTA
  83.     mov    es:[si],ax    ;Store in low word of filesize doubleint.
  84.     mov    ax,[di]+7    ;Hi word of fs.
  85.     mov    es:[si+2],ax    ;Store in hi word of fs doub int.
  86. ;DONE! now restore ds,bp and return
  87.     pop    ds        ;Restore DS
  88.     pop    bp        ;Restore BP
  89. finddata ends
  90.     end
  91.     
  92.  
  93.